package com.shuihu.liutang.configuration;
/*
 * Help Information
 *
 * Create Date:2017/4/14
 *
 * zhangle
 */

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class Configuration {

    private static final String CONFIG_PATH = "liutang.properties";

    private static Properties properties;

    public static String getProperty(String key) throws IOException {
        if (properties == null) {
            properties = new Properties();
            InputStream in = Configuration.class.getClassLoader().getResourceAsStream(CONFIG_PATH);
            if (in == null) {
                throw new RuntimeException("get resource failure.");
            }
            properties.load(in);
            in.close();
        }
        return properties.getProperty(key);
    }
}
